<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      canvas {
        border: 1px solid #ccc;
      }
    </style>
  </head>
  <body>
    <script>
      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext("2d");

        ctx.font = ' bold italic 40px sans-serif' ;
        ctx.fillText("DMC" , 200 , 200 ) ;
      })();


      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext("2d");

        ctx.font = ' bold italic 80px sans-serif' ;
        ctx.strokeText("DMC" , 200 , 200 ,500) ;
      })();

      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext("2d");

        ctx.textAlign = 'center' ;
        ctx.font = '80px sans-serif' ;
        ctx.textBaseline = "middle" ;
        ctx.strokeText("DMC" , 200 , 200 ,500) ;

        const obj = ctx.measureText('DMC');
        console.log(obj);

        ctx.beginPath();
        ctx.fillStyle = '#f00';
        ctx.arc(200,200,4,0 , Math.PI*2);
        ctx.fill();

      })();
    </script>
  </body>
</html>
